import { Injectable, Inject } from '@nestjs/common';
import { PrismaService } from '@/prisma/prisma.service';

@Injectable()
export class StatisticsService {
  @Inject(PrismaService)
  private readonly prisma: PrismaService;

  async getStatistics() {
    const statisticsPromises = [
      this.prisma.user.count(),
      this.prisma.community.count(),
      this.prisma.scenic.count(),
    ];

    const [user, community, scenic] = await Promise.all(statisticsPromises);

    return {
      user,
      community,
      scenic,
    };
  }
}
